Create repository
= How Do I Create a New Repository? = This task is about creating a new, empty repository for a brand-new project. CVS Unlike most other VC systems, CVS seems to want you to put multiple unrelated projects in one repository. So creating a repository for a single project takes two steps: first, create the repository: mkdir -p /home/cvs/CVSROOT Here /home/cvs is the repository; the presence of CVSROOT is what makes it so. To add a project to the repository, the CVS manual recommends a rather awkward procedure; stripping it to the bare necessities: mkdir ~/src/project cd ~/src/project cvs import -m"useless" project useless1 useless2 Note that because no actual files are being imported, most of the arguments to the import command are useless. The only one that matters is project, which tells CVS to create project under $CVSROOT, i.e. /home/cvs/project. There is a much simpler way to add a new project to an existing repository, although this only works for a local (non-networked) repository: mkdir $CVSROOT/project However you add the project to your repository, you have to check it out to get a working directory. For the first method, you are already in your working directory (~/src/project), so would run cvs checkout -d . project For the second method, you'll need to get CVS to create your working directory: cd ~/src cvs checkout project References: * CVS manual, section 3 (http://ximbiot.com/cvs/manual/cvs-1.12.13/cvs_3.html) darcs git The simplest type of git setup is where you have a single working directory that contains the repository. This is perfectly appropriate for small, single-developer, non-networked projects. To create such a repository: mkdir ~/src/project cd ~/src/project git init At this point you can create files, git add, git commit, etc. Mercurial Similar to git, the simplest setup is a single combined working dir/repository: mkdir ~/src/project cd ~/src/project hg init And now you can run hg add, hg commit, etc. An alternate way to achieve the same result: mkdir ~/src hg init project cd project Subversion Creating a new Subversion repository first requires you to stop and think about the storage backend: fsfs is simple and straightforward (each revision is a separate file), but might not scale well to tens or hundreds of thousands of revisions (each revision is a separate file); bdb has a history of confusing errors, permissions problems, and mysterious corruption, but is probably faster for large repositories. I have seen all three of the above problems with bdb, and would be very careful about using it. Once that decision is made, creating the repository is easy: svnadmin create /home/svn/project Note that svnadmin always works on local repositories, so takes a filesystem path rather than a URL. This barebones creation method does not include the conventional trunk, branches, tags structure of a Subversion repository. If you're going to create those directories (and you probably should, unless you have a good reason to use your own convention), you can create them before even making your first checkout: svn mkdir -m"Create initial layout." file:///tmp/svn/project/{trunk,branches,tags} (Since that was done with svn, we had to make the jump from filesystem-space to URL-space here.) Checking out your new empty trunk is also easy cd ~/src svn checkout file:///home/svn/project/trunk project Category:Cookbook